<?php
use Mirage\Web;
/**
 * Description of UserController
 * Date Created Mar 11, 2012 7:30:02 PM
 * @package 
 * @author Bryan Salazar
 * 
 */
class UserController extends Mirage\Abstraction\AbstractController
{
    public $defaultAction = 'update';
    
    /**
     *
     * @var ExtSmarty 
     */
    public $view;
    
    public function actionUpdate()
    {
//        $this->view->assign('name','Ned');
//        $this->view->display('test.tpl');
        $this->view->render('test.tpl', array('name'=>'Ned'));
    }
    
    protected function setupRenderer()
    {
//        require_once Web::app()->getBasePath() . '/vendor/Smarty-3.1.8/libs/Smarty.class.php';
//        $this->view = new Smarty();
//        $this->view->template_dir = Web::app()->getModulePath() . '/front/views/user/';
//        $this->view->compile_dir = Web::app()->getModulePath() . '/front/viewsc/';
        
        $this->view = new ExtSmarty();
        $this->view->template_dir = Web::app()->getModulePath() . '/front/views/user/';
        $this->view->compile_dir = Web::app()->getModulePath() . '/front/viewsc/';
        $this->view->addTemplateDir(Web::app()->getModulePath() . '/front/views/layouts/');
        $this->view->layout = 'main.tpl';
    }
    
    public function beforeAction() {
        $this->setupRenderer();
    }
}
